package user

import (
	"time"

	"gitee.com/krio/grpc-go-server/dao/model"
	"gitee.com/krio/grpc-go-server/dao/model/common"
)

func (*UserLogin) TableName() string {
	return model.TableUserLogin
}

type UserLogin struct {
	*common.AutoincrID `xorm:"extends"`
	*common.SFID       `xorm:"extends"`
	PhoneNumber        string    `xorm:"varchar(15) comment('手机号') unique(sfid_phone)"`
	Email              string    `xorm:"default('') comment('邮箱')"`
	PhoneAreaCode      string    `xorm:"varchar(10) comment('手机区号')"`
	Password           string    `xorm:"char(64) comment('密码')"`
	WeChatId           string    `xorm:"varchar(200) comment('WeChat')"`
	FaceBookId         string    `xorm:"varchar(200) comment('FaceBook')"`
	State              UserState `xorm:"comment('账号状态')"`
	LastLoginTime      time.Time `xorm:"comment('最后一次登录时间')"`
	*common.CommonAT   `xorm:"extends"`
	DeletedTS          int32 `xorm:"deleted_ts default(0) comment('DeletedTS') index unique(sfid_phone)"`
}

type UserState int32 // 账号状态

const (
	CUSTOMER_ONLINE  UserState = iota + 1 // 在线
	CUSTOMER_OFFLINE                      // 离线
)
